//
// Created by Murphy on 2021/7/15.
//

/**
 * Lambertian
 * @version 1.0
 * @since 1.0
 * <p>
 * Created by Murphy at 2021/7/15 8:03
 **/
#include "Lambertian.hpp"
#include "usage/Hittable.hpp"
namespace Stitches
{


bool Lambertian::scatter(const Stitches::Ray &r_in, const Stitches::HitRecord &rec,
                                   Stitches::Vec3f &attenuation, Stitches::Ray &scattered) const
{
    Vec3f scatter_direction = rec.normal + randomUnitVector();
    scattered = Ray(rec.p, scatter_direction);
    attenuation = albedo;
    return true;
}

}